
#ifndef FLOW_H
#define FLOW_H
#include "../../include/vec1d.h"
#include "../../include/vec2d.h"
#include "inp.h"
#include "grid.h"
#include <cmath>
// #include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <fstream>

struct flow
{
    constexpr static size_t ncVar = 3;
    static size_t imax;
    static size_t ib2;
    vec2d<double> cv;
    vec2d<double> cvold;
    vec1d<double> p;
    vec1d<double> dt;
    vec2d<double> diss;
    vec2d<double> rhs;
    vec2d<double> ls, rs;
    vec1d<double> buffer1d;
    vec2d<double> buffer2d;

    flow() = default;
    flow(const flow &) = delete;
    flow(flow &&) = delete;
    flow &operator=(const flow &) = delete;
    flow &operator=(flow &&) = delete;
    ~flow() = default;

    void iniMemory(size_t imax) noexcept;

    void iniFlow(const vec1d<double> &area) noexcept;

    void rsolut() noexcept;

    void bcond(const vec1d<double> &area, const size_t ib2) noexcept;

    void solver(const Grid &, double &drho) noexcept;

    void timeStep(const vec1d<double> &vol, const vec1d<double> &area,
                  const vec1d<double> &x) noexcept;

    void dissip(const vec1d<double> &vol, double beta) noexcept;

    void fluxCen(const vec1d<double> &area) noexcept;

    void LRStateCusp(const vec1d<double>& area) noexcept;

    void FluxCusp(const vec1d<double>& area) noexcept;

    void LRStateRoe(const vec1d<double>& area, const vec1d<double>& vol) noexcept;

    void FluxRoe(const vec1d<double>& area) noexcept;

    void SrcTerm(const vec1d<double> &area) noexcept;

    void Irsmoo() noexcept;

    void UpdateConservativeVar(const vec1d<double> &area) noexcept;

    void Conver(double &dhro, const string &convergence_file_name, const vec1d<double> &area) noexcept;
};

#endif